#{extends 'CRUD/layout.html' /}
#{set title:messages.get('users') /}

<script>
$(document).ready(function() {
	$("tbody tr").each(function() {
		$(this).removeClass("odd").removeClass("even");
		$(this).find("td").each(function() {
			var link = $(this).find('.hiddenLinks').text();
			$(this).click(function() {
				$(location).attr("href", link);
			});
			$(this).hover(
			  function () {
			    $(this).addClass("hover");
			  },
			  function () {
			    $(this).removeClass("hover");
			  });
		});	
	});
});
</script>

<div id="crudList" class="${type.name}">

    <h2 id="crudListTitle">&{'users'}</h2>

    <div id="crudListTable">
        #{crud.table fields:['lastName', 'firstName', 'middleName', 'post', 'roles']}
		#{crud.custom 'lastName'}
              	<span class="hiddenLinks">@{Users.show(object.userId)}</span>
              	&{object.lastName}
		#{/crud.custom} 
		#{crud.custom 'firstName'}
				<span class="hiddenLinks">@{Users.show(object.userId)}</span>
              	&{object.firstName}
		#{/crud.custom} 
		#{crud.custom 'middleName'}
				<span class="hiddenLinks">@{Users.show(object.userId)}</span>
              	&{object.middleName}
		#{/crud.custom}
		#{crud.custom 'post'}
				<span class="hiddenLinks">@{Users.show(object.userId)}</span>
              	&{object.post}
		#{/crud.custom}
		#{crud.custom 'roles'}
				<span class="hiddenLinks">@{Users.show(object.userId)}</span>
				&{object.roles.roleName}
		#{/crud.custom}        
		#{/crud.table}        
    </div>

    <div id="crudListPagination">
        &{'total', models.User.count()}
        #{pagination /}
    </div>

    <p id="crudListAdd">
        <a href="@{blank()}">&{'user.add'}</a>
    </p>

</div>
